<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }
        html,body {
            width:100%;
            height:100%;
        }
        body {
            background:linear-gradient(to bottom,yellowgreen,dodgerblue);
        }
        .box {
            width: 200px;
            height: 200px;
            margin:200px auto;
            transform-style:preserve-3d;
            position: relative;
        }
        .item {
            height: 100%;
            width: 100%;
            font: 700 50px/200px "microsoft yahei";
            position: absolute;
            text-align: center;
            background:paleturquoise;
            opacity:.5;
            border:2px solid dodgerblue;
            transition:all .3s 0s ease-in;
        }
        .item:nth-child(1) {
            transform:translateZ(100px);
        }
        .item:nth-child(2) {
            transform:rotateY(90deg) translateZ(100px);
        }
        .item:nth-child(3) {
            transform:rotateY(180deg) translateZ(100px);
        }
        .item:nth-child(4) {
            transform:rotateY(-90deg) translateZ(100px);
        }
        .item:nth-child(5){
            transform:rotateX(90deg) translateZ(100px);
        }
        .item:nth-child(6){
            transform:rotateX(-90deg) translateZ(100px);
        }
        .in {
            width:50%;
            height:50%;
            position:absolute;
            background:deepskyblue;
            top:50px;
            left:50px;
        }
        span:nth-of-type(1) {
            transform:translateZ(50px);
        }
        span:nth-of-type(2) {
            transform:rotateY(90deg) translateZ(50px);
        }
        span:nth-of-type(3){
            transform:rotateY(180deg) translateZ(50px);
        }
        span:nth-of-type(4){
            transform:rotateY(-90deg) translateZ(50px);
        }
        span:nth-of-type(5){
            transform:rotateX(90deg) translateZ(50px);
        }
        span:nth-of-type(6){
            transform:rotateX(-90deg) translateZ(50px);
        }
        .box:hover .item:nth-child(1) {
            transform:translateZ(200px);
        }
        .box:hover .item:nth-child(2){
            transform:rotateY(90deg) translateZ(200px);
        }
        .box:hover .item:nth-child(3){
            transform:rotateY(180deg) translateZ(200px);
        }
        .box:hover .item:nth-child(4) {
            transform:rotateY(-90deg) translateZ(200px);
        }
        .box:hover .item:nth-child(5) {
            transform:rotateX(90deg) translateZ(200px);
        }
        .box:hover .item:nth-child(6){
            transform:rotateX(-90deg) translateZ(200px);
        }
    </style>
</head>
<body>
<div class="box">
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <span class="in"></span>
    <span class="in"></span>
    <span class="in"></span>
    <span class="in"></span>
    <span class="in"></span>
    <span class="in"></span>
</div>
<script>
    var box = document.querySelector(".box");
    var deg = 0;
    setInterval(function(){
        deg+=.5;
        box.style.transform = "rotateX("+deg+"deg) rotateY("+deg+"deg)"
    },15)
</script>
</body>
</html>